package gamecenter.gc.service.Imp;

import gamecenter.gc.bean.Administrator;
import gamecenter.gc.bean.User;
import gamecenter.gc.mapper.Administrator_Mapper;
import gamecenter.gc.mapper.User_Mapper;
import gamecenter.gc.service.Administrator_Service;
import gamecenter.gc.service.User_Service;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class Administrator_Service_Imp implements Administrator_Service {
    @Resource
    private Administrator_Mapper administrator_Mapper;

    @Override
    public boolean register(String name, String password) {
        Administrator administrator = administrator_Mapper.get_Cer_Administrator_From_Name(name);
        if (administrator != null) {
            return false;
        }
        administrator_Mapper.register(name, password);
        return true;
    }

    @Override
    public Administrator get_Cer_Administrator_From_Name(String name) {
        return administrator_Mapper.get_Cer_Administrator_From_Name(name);
    }

    @Override
    public boolean check_Administrator(String name, String password) {
        Administrator administrator = administrator_Mapper.check_Administrator(name, password);
        return administrator != null;
    }

    @Override
    public void modify_Administrator_Password(String name, String password) {
        administrator_Mapper.modify_Administrator_Password(name, password);
    }

    @Override
    public void modify_Administrator_Photo(String name, String photo) {
        administrator_Mapper.modify_Administrator_Photo(name, photo);
    }

}
